<?php
    $model        = $order['BrandModel'];
    $customerType = $order['CustomerType'];
    $store        = $order['Store'];
    $order        = $order['Order'];
    
?><section id="paper">
    <header>
        <?= $this->Html->image('stores/' . $store['logo']) ?>
        <div class="address">
            <?= $store['address'] ?> &middot;
            <?= $store['phone'] ?>
        </div>
    </header>
    
    <h1>Nalog <?= sprintf("%05d", $order['id']) ?></h1>
    <section id="order">
        <strong>Datum:</strong><span><?= date_local($order['datum_izdavanja'], 'd.F Y') ?></span>
        <strong>Ime i Prezime:</strong><span><?= $order['musterija_ime'] ?> (<?= $customerType['tip']?>)</span>
        <strong>Telefon:</strong><span><?= $order['musterija_telefon'] ?></span>
        <strong>Aparat:</strong><span><?= $model['Brand']['name'] ?> / <?= $model['name'] ?></span>
        <strong>&nbsp;</strong><span>IMEI-<?= $order['imei'] ?></span>
        <strong>Opis problema:</strong><span><?= $order['problem'] ?></span>
        <strong>Baterija:</strong><span><?= (int)$order['baterija'] ? 'DA' : 'NE' ?></span>
        <strong class="inline">Punjač:</strong><span><?= (int)$order['punjac'] ? 'DA' : 'NE' ?></span>
        <strong class="inline">Garancija:</strong><span><?= (int)$order['garancija'] ? 'DA' . (empty($order['garancija_od']) ? '' : '('.$order['garancija_od'].')') : 'NE' ?></span>
        <strong>Cena:</strong><span><?= number_format($order["cena"], 2, ",", ".") ?></span><span class="currency">DIN</span>
        <strong class="inline">Naplaćeno:</strong><span><?= number_format($order["naplaceno"], 2, ",", ".") ?></span><span class="currency">DIN</span>
        <strong>Popravljeno:</strong><span><?= date_local($order["datum_popravke"], "d.F Y") ?></span>
        <strong class="inline">Preuzeto:</strong><span><?= date_local($order["datum_preuzimanja"], "d.F Y") ?></span>
        <strong>Napomena:</strong><span><?= $order['napomena'] ?></span>
    </section>
    <br clear="all">
    <footer>
        <strong>NAPOMENA:</strong>
        <span>
            Servis ne preuzima odgovornost za sadržaj telefona. Sami morate sačuvati sadržaj telefona pre donošenja.
            <br>Maksimalni rok za preuzimanje aparata je 90 dana od dana prijema aparata na servis.
        </span>
    </footer>
</section>